package com.linhz.demo03.CopyFile;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

public class Demo01CopyFile {
    public static void main(String[] args) throws IOException {
        long s = System.currentTimeMillis();
        FileInputStream fis = new FileInputStream("img/test1.png");
        FileOutputStream fos = new FileOutputStream("img/test4.png");

        byte[] bytes = new byte[1024];


        int len = 0;

        while ((len = fis.read(bytes))!=-1){
            fos.write(bytes,0,len);
        }
        fos.close();
        fis.close();
        long e = System.currentTimeMillis();
        System.out.println("复制文件共花费"+(e-s)+"毫秒");
    }
}
